package com.example.bottommenutest;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * @author Yingyong Lao
 * 创建时间 2021/8/28 18:42
 * @version 1.0
 */
public class ChannelFragment extends Fragment {
    private String con="";
    private TextView tv;
    private static  final String CONTENT="content";
    private static final String TAG = "ChannelFragment";
    public static ChannelFragment getInstance(String content){
        Log.d(TAG, "getInstance: ");
        ChannelFragment channelFragment=new ChannelFragment();
        Bundle bundle=new Bundle();
        bundle.putString(CONTENT,content);
        channelFragment.setArguments(bundle);
        return channelFragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate: ");
        Bundle bundle = getArguments();
        if(bundle!=null){
            con=bundle.getString(CONTENT);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_channel, container, false);
        tv=view.findViewById(R.id.tv);
        tv.setText(con);
        return view;
    }
}